﻿@using QDT.Core
@using QDT.Core.Members
@model QDT.Common.IPagedList<QDT.Core.Orders.ChargeOrder>
@{
    ViewBag.Title = "用户充值";
    User user = QDTContext.Current.User;
}
@section Head{
    <style type="text/css">
        #payment_box img
        {
            cursor: pointer;
        }
        .ui-form-inch
        {
            font-size: 14px;
            line-height: 1.5;
            border-bottom: 1px solid #ccc;
        }
        .t-orders
        {
            width: 100%;
            text-align: center;
        }
        .t-orders tr th
        {
            text-align: center;
        }
        .t-orders tr
        {
            line-height: 40px;
        }
        .t-orders tbody tr
        {
            border-bottom: 1px dashed #ccc;
        }
        .ui-box-blok
        {
            margin-top: 20px;
            padding-left: 10px;
        }
        .ui-pay .active
        {
            border-radius: 4px;
            width: 120px;
            padding: 5px 5px 0 5px;
            text-align: left;
        }
        #Money
        {
            width: 111px;
            height: 23px;
        }
        .dealcolor{border: 1px solid #d52d18;border-radius: 4px;text-align: center;width: 60px;color: #d52d18;display: inline-block;line-height: 22px;}
        .dealcolor:hover{background-color: #d52d18;color: #ffffff;}
    </style>
}
<div class="">
    @Html.Action("_UserBanner")
    <div class="ui-inner">
        <div class="ui-grid-row">
            @Html.Action("UserMenu", new { route = MenuRoute.Recharge })
            <div class="ui-grid-20" style="width: 758px; margin: 0; height: 520px;">
@*                @if (user.IDCardPassed)*@
@*                {*@
                    <div class="">
                        <div class="ui-box-blok" style="border-bottom: 1px solid #ccc;">
                            <span style="font-size: 18px; display: inline-block; margin-bottom: 10px;">充值帮助</span>
                            <div class="">
                                <p class="ui-tipbox-explain" style="color: #ccc">
                                    1、充值免费，充值产生的第三方支付平台费用由众禧贷承担；</p>
                                <p class="ui-tipbox-explain" style="color: #ccc">
                                    2、为了您的资金安全，请您在充值之前先完成实名认证；</p>
                                <p class="ui-tipbox-explain" style="color: #ccc">
                                    3、每日的充值限额依据各银行限额为准；</p>
                                <p class="ui-tipbox-explain" style="color: #ccc">
                                    4、如果充值金额没有及时到账，请和客服联系。</p>
                            </div>
                        </div>
                        <form name="incharge_form" class="ui-form-inch" id="incharge_form" action="@Url.Action("PostMoneyIncharge")" method="post" target="_blank">
                            <fieldset style="margin-left: 100px;" class="ui-box-blok">
                                <legend></legend>
                                <div style="margin-left: -100px;">
                                    <span style="font-size: 18px;">账户充值</span></div>
                                <div class="ui-form-item">
                                    <label for="" class="ui-label" style="margin-top: 4px;">
                                        当前可以金额</label>
                                    <p class="ui-form-explain" style="color: #ff9001;font-size: 16px;">@user.UserAccount.Money.ToMoney()</p>
                                </div>
                                <div class="ui-form-item">
                                    <label for="" class="ui-label" style="margin-top: 5px;">
                                        充值金额</label>
                                    <input class="ui-input ui-input-large" type="text" id="Money" name="Money" />
                                    <span class="ui-form-other">元</span>
                                    <p class="ui-form-explain">
                                        您的资金将从充值银行卡转入第三方支付合作账户</p>
                                </div>
                                <div class="ui-form-item">
                                    <label for="" class="ui-label" style="margin-top: 11px;">
                                        充值方式</label>
                                    <div class="ui-form-text">
                                        <ul class="ui-pay" id="payment_box">
                                            <li class="active">
                                                <label>
                                                    <img src="/Plugins/Content/allinpay.png" width="111" height="32">
                                                    <i class="iconfont">&#xe60f;</i>
                                                </label>
                                            </li>
                                        </ul>
                                    </div>
                                    <p class="ui-form-explain" style="padding: 0; color: #e74c3c">
                                        重要提示：您在充值成功前切勿关闭支付页面，否则会导致充值无法正常到账。</p>
                                </div>
                                <div class="ui-form-item">
                                    @if (user.GroupID == 3||user.GroupID==2)
                                    {
                                        <input class="ui-button ui-button-red big" type="submit" id="incharge_done" value="充值" />
                                    }
                                </div>
                            </fieldset>
                            <script type="text/javascript">
                                $(document).ready(function () {
                                    $("#incharge_form").submit(function () {
                                        var inchargeMoney = $("input[name='Money']").val();
                                        if (!(inchargeMoney != '' && !isNaN(inchargeMoney) && inchargeMoney > 0)) {
                                            alert("请输入正确的充值金额");
                                            $("input[name='money']").focus();
                                            return false;
                                        }
                                        return true;
                                    });
                                });
                                
                            </script>
                        </form>
                        <div class="ui-box-blok">
                            <span style="font-size: 18px;">充值订单</span><br />
                            <table class="t-orders">
                                <thead>
                                    <tr>
                                        <th>
                                            时间
                                        </th>
                                        <th>
                                            订单号
                                        </th>
                                        <th>
                                            金额
                                        </th>
                                        <th>
                                            状态
                                        </th>
                                        <th>
                                        </th>
                                    </tr>
                                </thead>
                                <tbody>
                                    @foreach (var charge in Model)
                                    {
                                        <tr>
                                            <td>
                                                @charge.CreateTime
                                            </td>
                                            <td>
                                                @charge.OrderSN
                                            </td>
                                            <td>
                                                @charge.TotalPrice.ToMoney()
                                            </td>
                                            <td>
                                                @if (charge.InnerStatus == 0)
                                                {
                                                    <span>未支付</span>
                                                }
                                                else if (charge.InnerStatus == 1)
                                                {
                                                    if ((int) DateTime.Now.Subtract(charge.CreateTime).TotalHours > 1)
                                                    {
                                                        <span>失效</span>
                                                    }
                                                    else
                                                    {
                                                        <span>
                                                            <a href="@Url.Action("Pay", "Payment", new { orderId = charge.ID })" target="_blank" class="dealcolor">立即支付</a>
                                                        </span>
                                                    }
                                                }
                                                else if (charge.InnerStatus == 2)
                                                {
                                                    <span>完成</span>
                                                }
                                                else if (charge.InnerStatus == 3)
                                                {
                                                    <span>失败</span>
                                                }
                                            </td>
                                        </tr>
                                    }
                                  
                                </tbody>
                            </table>
                        </div>
                    </div>
@*                }*@
@*               else*@
@*                {*@
@*                    <div class="ui-body">*@
@*                        <div class="ui-inner">*@
@*                            <div class="ui-tipbox ui-tipbox-wait">*@
@*                                <div class="ui-tipbox-icon">*@
@*                                    <i class="iconfont" title="提示">&#xf0142;</i>*@
@*                                </div>*@
@*                                <div class="ui-tipbox-content">*@
@*                                    <h3 class="ui-tipbox-title">*@
@*                                        温馨提示</h3>*@
@*                                    <p class="ui-tipbox-explain">*@
@*                                        为了您的账户安全，充值前请进行实名认证</p>*@
@*                                    <p class="ui-tipbox-explain">*@
@*                                        <a href="@Url.Action("BindIdCard")">进行实名认证</a> | <a href="@Url.Action("Index")">返回</a></p>*@
@*                                </div>*@
@*                            </div>*@
@*                        </div>*@
@*                    </div>*@
@*                }*@
            </div>
        </div>
    </div>
</div>
<div style="margin-top: -10px;">@Html.Partial("_BindBottomImage")</div>
<script type="text/javascript">
    $().ready(function () {
        $("#Recharge").css("background", "#e0524b");
        $("#Recharge i,#Recharge span").css("color", "white");
        $("#Recharge .san-jiaoxing").css("display", "block");
    });
</script>